﻿// ***********************************************************************
// Assembly         : ElFinder.Net
// Author           : Lolo
// Created          : 06-05-2013
//
// Last Modified By : Lolo
// Last Modified On : 06-05-2013
// ***********************************************************************
// <copyright file="Error.cs" company="">
//     Copyright (c) . All rights reserved.
// </copyright>
// <summary></summary>
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace ElFinder.DTO
{
    /// <summary>
    /// Class Error
    /// </summary>
    internal static class Error
    {
        /// <summary>
        /// Commands the not found.
        /// </summary>
        /// <returns>JsonResult.</returns>
        public static JsonResult CommandNotFound()
        {
            return Json(new { error = "errUnknownCmd" });
        }
        /// <summary>
        /// Misseds the parameter.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <returns>JsonResult.</returns>
        public static JsonResult MissedParameter(string command)
        {
            return Json(new { error = new string[] { "errCmdParams", command } });
        }
        /// <summary>
        /// Jsons the specified data.
        /// </summary>
        /// <param name="data">The data.</param>
        /// <returns>JsonResult.</returns>
        private static JsonResult Json(object data)
        {
            return new JsonDataContractResult(data) { JsonRequestBehavior = JsonRequestBehavior.AllowGet };
        }
    }
}